package com.jili.single;

/**
 * ClassName: TVDemo
 * Package com.jili.single
 * Description:
 *
 * @Author: 廖继礼
 * @Create: 2024/7/27
 * @Version: v1.0
 */
public class TVDemo {
    public static void main(String[] args) {
        XiaoMi xiaoMi = new XiaoMi();
        OpenSwitch openSwitch = new OpenSwitch();
        openSwitch.setItv(xiaoMi);
        openSwitch.open();

    }
}

interface ITV{
    void play();
}

class OpenSwitch {

    private ITV itv;

    public void setItv(ITV itv) {
        this.itv = itv;
    }

    public void open(){
        itv.play();
    }
}

class XiaoMi implements ITV{

    @Override
    public void play() {
        System.out.println("长虹电视播放");
    }
}

